<template>
    <div>
        <button @click="getSend">get 方法发送 username password</button>
        <button @click="postSend"> Post 方法发送 username password</button>
        <button @click="test">携带cookie访问</button>
        <button @click="$router.push({name:'sub'})"> push</button>
<!--        <MyWord></MyWord>-->
        <my></my>
    </div>
</template>

<script>
    import my from './GoodBye'
    let a = {};
    console.log(a['s']==undefined)
    let login ={
        data(){
            return {
                username: "",
                password: "",
            }
        },
        components: {my},
        methods:{
            getSend() {
                this.$http({
                    url: this.$http.adornUrl('/getLogin'),
                    method:'get',
                    params: this.$http.adornParams({
                        "me": "张铭兴",
                        "today": "ko你们所有人"
                    }),
                }).then(data=>{
                    console.log(data)
                }).catch(error=>{
                    console.log(error)
                })
            },
            test() {
                this.$http({
                    url: this.$http.adornUrl('/getLogin'),
                    method:'get',
                }).then(data=>{
                    console.log(data)
                }).catch(error=>{
                    console.log(error)
                })
            },
            postSend() {
                this.$http.post('/postLogin', {
                    "me": "张铭兴",
                    "today": "ko你们所有人"
                }).then(form=>{
                    let token = form.data;
                    this.$cookie.set('token',token,1)
                })
            }
        }
    }
    export default login
</script>

<style scoped>

</style>